extends KinematicBody2D

var visable_to_eagle = true

var target_pos = Vector2()
var speed:int = 3

func _ready():
	self.name = "player"

func _input(event):
	if event is InputEventMouseButton:
		if event.is_pressed() and event.button_index == BUTTON_LEFT:
			target_pos = get_global_mouse_position()
			$sprite.play("walk")
	pass
	
func _process(delta):
	if target_pos:
		if target_pos.distance_to(global_position) >0:
			global_position = global_position.move_toward(target_pos,speed)

func change_anim(anim):
	$sprite.play(anim)

func play_hide():
	$sprite.play("hide")
	visable_to_eagle = false

func play_show():
	$sprite.play("walk")
	visable_to_eagle = true
